package com.xc.freeapp.account.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.xc.freeapp.common.ResponseBean;
import com.xc.freeapp.entity.Vaccines;
import com.xc.freeapp.exception.BaseException;
import com.xc.freeapp.service.VaccinesService;
import com.xc.freeapp.util.TokenAnnotation;


@Controller
@RequestMapping("/vassines")
@Api(value="/vassines",description = "接种人疫苗")

public class VaccinesController extends AbstractController {
	@Autowired
	private VaccinesService vaccinesServiceImpl;

	/**
	 * 获取接种人疫苗列表
	 * 
	 * @param requestMap
	 * @return
	 */
	@TokenAnnotation(required=false)
	@RequestMapping(value = "", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation(value = "获取接种人疫苗列表")
	public List<Vaccines> getVaccinesListByVaccinePerson(
			@RequestParam("vaccineperid") String vaccineperid)
			throws BaseException {

		List<Vaccines> vaccinesList = vaccinesServiceImpl
				.getVaccinesList(Integer.valueOf(vaccineperid));
		return vaccinesList;

	}

	/**
	 * 更新接种人疫苗列表
	 * 
	 * @param requestMap
	 * @return
	 */
	@TokenAnnotation(required=false)
	@RequestMapping(value = "/update", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation(value = "更新接种人疫苗列表")
	public ResponseBean updateVaccinesList(
			@RequestParam("vaccineperid") String vaccineperid,
			@RequestParam("vaccineType") String vaccineType,
			@RequestParam("ifdo") String ifdo)
			throws BaseException {

		vaccinesServiceImpl.updateifdo(Integer.valueOf(vaccineperid),
				Integer.valueOf(vaccineType), Integer.valueOf(ifdo));
		return ResponseBean.getSuccess();

	}

}
